import React, { Component } from 'react'

export default class TableBody extends Component {
    render() {
        const {courseData} = this.props;
        return (
            <tbody>
                {
                    courseData.map((item,index)=>{
                        return(
                            <tr>
                                <td>{item.cid}</td>
                                <td>
                                    <a href={item.href} target="_blank">
                                        <img 
                                            src={`http://qexgb3yqx.hn-bkt.clouddn.com/${item.posterKey}`}
                                            alt={item.courseName}
                                        ></img>
                                    </a>
                                </td>
                                <td>
                                    <a href={item.href} target="_blank">{item.courseName}</a>
                                </td>
                                <td>
                                    <span className={item.price === '0' ? 'free' :'price'}>
                                        {item.price === '0' ? '免费' : `￥${item.price}`}
                                    </span>
                                </td>
                                <td>{item.studentCount}</td>
                                <td></td>
                                <td>
                                    <button className={['btn',item.status ? 'btn-danger':'btn-success'].join(' ')}></button>
                                </td>
                            </tr>
                        )
                    })
                }
            </tbody>
        )
    }
}
